<?php
namespace phpmailer;

use phpmailer\src\PHPMailer;

class Mail
{
	
	public static function send($to,$title,$contet,$name='')
	{

		                              
		// Passing `true` enables exceptions
		try {
			$mail = new PHPMailer(true);
		    //Server settings
		    // $mail->SMTPDebug = true;
		    $mail->isSMTP();
		    $mail->Host = config('email.host');
		    $mail->SMTPAuth = true;
		    $mail->Username = config('email.user');
		    $mail->Password = config('email.password');
		    $mail->SMTPSecure =config('email.secure');
		    $mail->Port = config('email.port');


		    $mail->setFrom(config('email.user'), config('stie_name'));

		    $mail->addAddress($to);  

		    // $mail->addAttachment('./robots.txt'); 
		    //        
		    $mail->isHTML(true);

		    $mail->Subject = $title;
		    $mail->Body    = $contet;

		    $mail->send();

		    return true;

		} catch (\phpmailer\src\Exception $e) {
		    return false;
		}
		
	}
}
